package com.kanqiubao.kq.utils;

import android.content.Context;
import android.util.Log;
import android.view.Gravity;
import android.widget.Toast;

import com.hjq.toast.ToastUtils;

public class DebugUntil {

	public static boolean mFlagLogDebug = false;

	private static final String Tag = "RG";

	private Toast mToast;

	public static DebugUntil mDebugUntil;

	public void toastStr(String str, Context cox) {
		if (mToast == null) {
			mToast = Toast.makeText(cox, str, 2000);
			mToast.setGravity(Gravity.CENTER, 0, 0);
			mToast.show();
		} else {
			mToast.setText(str);
			mToast.show();
		}
	}

	public void toastStr(String str) {
        ToastUtils.show(str);
//		if (mToast == null) {
//			mToast = Toast
//					.makeText(ThisAppApplication.getInstance(), str, 2000);
//			mToast.setGravity(Gravity.CENTER, 0, 0);
//			mToast.show();
//		} else {
//			mToast.setText(str);
//			mToast.show();
//		}
	}

	public static void logDebug(String str) {
		if (mFlagLogDebug) {
			Log.e(Tag, str);
		}
	}

	public static DebugUntil createInstance() {
		if (mDebugUntil == null) {
			mDebugUntil = new DebugUntil();
			return mDebugUntil;
		} else {
			return mDebugUntil;
		}
	}

	public static void SystemPrintOut(String tag, String str) {
		if (mFlagLogDebug) {
			if (mDebugUntil == null) {
				System.out.printf(tag + "------>>>>>>" + str);
			}
		} else {
			return;
		}
	}

	private DebugUntil() {
	}
}
